package org.huangrui.design.pattern.singleton;

import java.io.IOException;
import java.util.Properties;

/**
 * 有点小问题
 * @author hr
 * @create 2025-09-09 14:11
 */
public class Singleton3 {
	private static final Singleton3 INSTANCE;
	private String info;
	static{
		try {
			Properties pro = new Properties();
			pro.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("single.properties"));
			INSTANCE = new Singleton3(pro.getProperty("info"));
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	private Singleton3(String info){
		this.info = info;
	}

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	@Override
	public String toString() {
		return "Singleton3 [info=" + info + "]";
	}

	public static void main(String[] args) {
		Singleton3 instance = Singleton3.INSTANCE;
		System.out.println(instance);
	}

}
